#include <iostream>
#include "AltLRU.hpp"

using namespace std;

static int constr_cnt;
static int destr_cnt;
static int constr_copy_cnt;
static int assign_cnt;

class A {
public:
	A(){
		cout << "A::A()\n";
		constr_cnt++;
	}
	~A(){
		cout << "A::~A()\n";
		destr_cnt++;
	}
	A(const A &v) {
		cout << "A::A(A&)\n";
		constr_copy_cnt++;
	}
	const A &operator=(const A& v) {
		cout << "A::operator=\n";
		assign_cnt++;
		return v;
	}
};

int main() {
	AltLRU<A> lru(1);

	//test1
	cout << "Get nonexistent\n";
	auto v1 = lru.get("nonexistent");

	//test2
	cout << "Set val\n";
	lru.set("val", A());
	cout << "Get val\n";
	auto v2 = lru.get("val");

	//test3
	cout << "Getset val\n";
	auto v3 = lru.getset("getset", []() -> A {
		cout << "Test3 lambda" << endl;
		return A();
	});

	return 0;
}
